﻿using Core.DomainServices;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace Infrastructure.DomainServices
{
    public class AppConfig : IAppConfig
    {
        public string OutputFolder
        {
            get
            {
                try
                {
                    return ConfigurationManager.AppSettings["OutputFolder"].ToString();
                }catch{
                    return Directory.GetCurrentDirectory().Replace("bin" + Path.DirectorySeparatorChar + "Debug", "DataSample") + Path.DirectorySeparatorChar;
                }
            }
        }

        public string TemplatePath
        {
            get
            {
                try
                {
                    var folder = ConfigurationManager.AppSettings["TemplatePath"];
                    if (!string.IsNullOrEmpty(folder))
                    {
                        return folder.ToString();
                    }
                    return Directory.GetCurrentDirectory().Replace("bin" + Path.DirectorySeparatorChar + "Debug", "DataSample") + Path.DirectorySeparatorChar + "TemplateData.xlsx";
                }
                catch
                {
                    return string.Empty;
                }
            }
        }
    }
}
